const { checkLogin } = require("../controller/user");
const { SuccessModel, ErrorModel } = require("../model/resModel");
const handelUserRouter = (req, res) => {
  const method = req.method;
  const path = req.path;
  if (method === "POST" && path === "/api/user/login") {
    const { userName, userPass } = req.body;
    const result = checkLogin(userName, userPass);
    if (result) {
      return new SuccessModel("登录成功");
    } else {
      return new ErrorModel("登录失败");
    }
  }
};
module.exports = handelUserRouter;
